import unittest

import requests

from utest.testlib import add_x_y
from parameterized import parameterized


class MyTest3(unittest.TestCase):
    """
    pip install parameterized
    """

    @parameterized.expand([
        ["相加", 1, 1, 2],
        ["相减", 1, -1, 0],
        ["整数+小数", 1, 1.1, 2.1],
    ])
    def test_add(self, name, x, y, z):
        print(name)
        zz = add_x_y(x, y)
        self.assertEqual(zz, z, "结果错误")

    # @parameterized.expand([
    #     ['a1', 'p1'],
    #     ['a2', 'p2'],
    # ])
    # def test_login(self, username, password):
    #     params = {
    #         'username': username,
    #         'password': password,
    #     }
    #     requests.post('ip:port/login', data=params)
